package com.zzyl.nursing.vo;

import com.zzyl.common.core.page.TableDataInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @version: 1.0
 * @Author: ljy
 * @description: 自己封装的返回结果
 * @date: 2025-07-31 22:19
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private TableDataInfo data;


    /**
     * 成功
     *
     * @param data
     * @return
     */
    public static Result success(TableDataInfo data) {
        return new Result(200, "操作成功", data);
    }


    /**
     * 失败
     *
     * @param msg
     * @return
     */
    public static Result error(String msg) {
        return new Result(500, msg, null);
    }
}
